<script setup>
import {logout} from "@/net";
import router from "@/router";

function  userLogout(){
  console.log("userlogout")
  let str = sessionStorage.getItem("token") || localStorage.getItem("token");
    console.log("sessionStorage.getItem(): "+sessionStorage)
    console.log("localStorage.getItem(): " + localStorage)
  if(str){
    console.log("userLogout:success")
  }  else{
    console.log("logout:failed")
  }
  logout(() => router.push('/'))
}

</script>
<template>
   <div>
     <el-button @click="userLogout">退出登录</el-button>
   </div>
</template>
<style scoped>
</style>